<template>
  <div>
    <el-container>
      <el-main>
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <span style="display:flex; justify-content: left;font-weight: bolder">收款人</span>
          </div>
            <el-form :label-position="labelPosition" label-width="80px" :model="formLabelAlign">
              <el-form-item label="手机号">
                <el-input v-model="j101ByPhone.qrytelephone"></el-input>
              </el-form-item>
              <el-form-item label="收款户名">
                <el-input v-model="j101ByPhone.qryname"></el-input>
              </el-form-item>
            </el-form>
        </el-card>
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <span style="display:flex; justify-content: left;font-weight: bolder">转出账户</span>
          </div>
            <el-form :label-position="labelPosition" label-width="80px" :model="formLabelAlign">
              <el-form-item label="户名">
                <el-input v-model="j101ByPhone.payerName"></el-input>
              </el-form-item>
              <el-form-item label="账号">
                <el-input v-model="j101ByPhone.payerActno"></el-input>
              </el-form-item>
              <el-form-item label="银行">
                <el-input v-model="j101ByPhone.payerOpNetbrno"></el-input>
              </el-form-item>
            </el-form>
        </el-card>
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <span style="display:flex; justify-content: left;font-weight: bolder">转账金额</span>
          </div>
            <el-form :label-position="labelPosition" label-width="80px" :model="formLabelAlign">
              <el-form-item label="金额">
                <el-input v-model="j101ByPhone.amount"></el-input>
              </el-form-item>
              <el-form-item label="转账附言">
                <el-input v-model="j101ByPhone.remarks"></el-input>
              </el-form-item>
            </el-form>
        </el-card>

        <el-row class="" style="display: flex; justify-content: space-around;margin-top: 30px;">
          <el-button style="width: 150px;" type="primary" @click="toPasswordVerify">确认转账</el-button>
        </el-row>
      </el-main>
    </el-container>

    <el-dialog title="请输入密码" :visible.sync="dialogFormVisible" width="280px">
      <el-form :model="form">
        <span>请输入6位交易密码</span>
        <el-input v-model="form.name" autocomplete="off"></el-input>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="accountTransCommit">确 定</el-button>
      </div>
    </el-dialog>

  </div>
</template>
<style>

</style>
<script>
import {ibps101sendByPhone} from "@/api/ibps/ebank";

export default {
  data(){
    return {

      j101ByPhone:{ // payee 收款人 payer 付款人


        "payeeActno":"4321",
        "payeeName":"huateng",
        "payeeOpNetbrno":"12343333",
        "payeeStBrno":"12343333",

        qryname:"测试收款人名称",
        qrytelephone:"18266668888",

        "payerActno":"6225881010029001",
        "payerActtype":"1",
        "payerName":"测试付款人名称",
        "payerOpCitycode":"1",
        "payerOpNetbrno":"313301008887",
        "payerStBrno":"313301008887",

        "amount":0,
        "remarks":"",

        // ------------------------
        "pkgid":"12349999",
        "acceptDate":"20230811",
        "bizCode":"1",
        "bizType":"0",
        "btFlg":"false",
        "chkDate":"20230811",
        "chkRound":"1",
        "chrgBr":"DEBT",
        "clrDate":"20230811",
        "curcd":"CNY",
        "dltAmt":1234,
        "dtlCnt":1,
        "e2eId":"e2eId",
        "instrPrty":"NORM",

        "senderDatetime":"20230811121212",
        "seqno":"1234",
        "stMethod":"CLRG"
      },
      dialogFormVisible:false,
      form:{
        name: '',
        region: '',
        date1: '',
        date2: '',
        delivery: false,
        type: [],
        resource: '',
        desc: ''
      },
      formLabelWidth:'120px',
      name:"",
      formLabelAlign: {
        name: '',
        region: '',
        type: ''
      },
      labelPosition:'',
    };
  },
  methods:{
    toPasswordVerify(){
      this.dialogFormVisible = true;
    },

    accountTransCommit(){
      console.log('phoneTransCommit');

      ibps101sendByPhone(this.j101ByPhone).then((res)=>{

        if(res.retStatus == 'SUCCESS'){

          this.$message({
            message: '转账成功',
            type: 'success',
            center: true,
          });
          this.dialogFormVisible = false;

        } else {
          this.$message({
            message: `转账失败: ${res.retStatus} - ${res.message}`,
            type: 'error',
            center: true,
          });
        }

      })


    },
  }
}
</script>
